const { defineConfig } = require('@vue/cli-service')
const productName = 'electron-测试';
const appId = 'com.itying.app.' + productName;
// menuCategory
const menuCategory = 'electron-测试1'; // 主目录
const shortcutName = 'electron-测试2'; // 图标名称

module.exports = defineConfig({
	configureWebpack: {
		// Webpack configuration applied to web builds and the electron renderer process
	},
	transpileDependencies: true,
	pluginOptions: {
		electronBuilder: {
			nodeIntegration: true,
			builderOptions: {
				productName: productName,
				appId: appId,
				publish: [
					{
						"provider": "generic",
						"url": "http://192.168.1.11:8080/download"
					}
				],
				win: {
					icon: 'public/icons/icon.ico',
					artifactName: '${productName}_setup_${version}.${ext}',
					target: ['nsis'],
				},
				nsis: {
					oneClick: false,
					menuCategory: menuCategory,
					shortcutName: shortcutName,
					allowToChangeInstallationDirectory: true,
					perMachine: true,
					runAfterFinish: true,
				},
				dmg: {
					contents: [
						{
							x: 410,
							y: 150,
							type: 'link',
							path: '/Applications',
						},
						{
							x: 130,
							y: 150,
							type: 'file',
						},
					],
				},
				mac: {
					icon: 'public/icon/icon.icns',
				},
				linux: {
					icon: 'public/icon/icon.ico',
				},
			}
		},
		'style-resources-loader': {
			preProcessor: 'less',
			patterns: []
		}
	},
	devServer: {
		port: 8181,
		proxy: {}
	},
})
